#include<stdio.h>
#include<stdlib.h>
typedef struct number
{
    int data;
    struct number *ptr;
}num;

num* addnum(num *head,int adddata )
{
    num *current=head;
    while(head!=NULL)
    {
        head=head->ptr;
    }
    num *add=(num*)malloc(sizeof(num));
    add->data=adddata;
    add->ptr=NULL;
    head=add;
    return current;
}

int findmax(num *head)
{
   num* current=head;
   int max=current->data;
   current=current->ptr;
   while(current->ptr!=NULL)
   {    
       if(current->data>max)
       {
           max=current->data;
        }
       current=current->ptr;
   }
    if(current->data>max)
       {
           max=current->data;
        }
    return max;
   
}

int findmin(num* head) 
{
     num* current=head;
   int min=current->data;
   current=current->ptr;
   while(current->ptr!=NULL)
   {    
       if(current->data<min)
       {
           min=current->data;
        }
       current=current->ptr;
   }
    if(current->data<min)
       {
           min=current->data;
        }
    return min;
}

int sumnum(num* head)
{
    num* current=head;
   int sum=current->data;
   current=current->ptr;
   while(current->ptr!=NULL)
   {    
       sum+=current->data;
       current=current->ptr;
   }
   sum+=current->data;
   return sum;
}

void shownum(num* head)
{
    num* current=head;
    while(current!=NULL)
    {
        printf("%d\n",current->data);
        current=current->ptr;
    }
    printf("%d\n",current->data);
    
}

int main()
{
    int a;
    num* head=NULL;
    while(1)
    {
        scanf("%d",&a);
        if(a==-1)
        {
            break;
        }
        else{
            head=addnum(head,a);
        }
    }
    
    int max=findmax(head);
    int min=findmin(head);
    int sum=sumnum(head);
    printf("The maximum,minmum and the total are:%d %d %d",max,min,sum);
    
     system("pause");
    return 0;
}